package com.ycfmedical.bed.present;


import com.ycfmedical.bed.local.DataManager;
import com.ycfmedical.bed.local.dao.HisSystemInfoDao;
import com.ycfmedical.bed.local.entity.BillRecords;
import com.ycfmedical.bed.local.entity.HisSystemInfo;
import com.ycfmedical.bed.ui.fragment.CheckBillFragment;
import com.ycfmedical.bed.ui.fragment.CheckMedicineFragement;

import java.util.ArrayList;
import java.util.List;

import cn.droidlover.xdroidmvp.kit.Kits;
import cn.droidlover.xdroidmvp.mvp.XPresent;

/**
 * Created by yf on 2017-04-20.
 */

public class HisCheckMedicinePrensenter extends XPresent<CheckMedicineFragement> {

    public void loadData() {
        List<HisSystemInfo> allHisInfoList = HisSystemInfoDao.getAllHisInfoList();
        List<HisSystemInfo> HisInfoList = new ArrayList<HisSystemInfo>();


        if (!Kits.Empty.check(allHisInfoList))
        {
            for (HisSystemInfo hisSystemInfo : allHisInfoList)
            {
                if(null!=DataManager.getInstance().getUser()){
                if (hisSystemInfo.getId() == DataManager.getInstance().getUser().getId())
                {
                   // setData(hisSystemInfo);
                    // 取出数据
              //      HisInfoList.add(hisSystemInfo);

                   setResultData(hisSystemInfo);
                }
                }
            }

        } else {
            // 当前数据库中不存在数据
        }
    }

    private BillRecords setData(String c1,String c2,String c3 ) {
        BillRecords billRecords=new BillRecords();
        billRecords.setExcelC1(c1);
        billRecords.setExcelC2(c2);
        billRecords.setExcelC3(c3);
        return billRecords;
    }

    private void setResultData(HisSystemInfo hisSystemInfo) {
 //     Spanned s= Html.fromHtml("<font color=\'#858585\'>购买前如有任何疑问，欢迎使用：</font><font color=\'#f02387\'><U>购物咨询</U></font>");


        List<BillRecords> billList = new ArrayList<BillRecords>();

        billList.add(setData("药品名称","服用时间","用药剂量"));

        billList.add(setData(hisSystemInfo.getMedicinename(),hisSystemInfo.getMedicinedata(),hisSystemInfo.getMedicinecomment()));
        billList.add(setData(hisSystemInfo.getMedicinename(),hisSystemInfo.getMedicinedata(),hisSystemInfo.getMedicinecomment()));
        getV().showData(billList);
    }





}
